#include "display.h"

int pause_album = 0;

void display(int mode){
    
            //printf("%d----------begin\n",mode);
    switch (mode)
    {
    case 0://home
    {
        lcd_display_bmp("/root/hcc/home2.bmp",0,0);
        if(x < 400)
        {
            mode = 1;
        }
        else if(x > 400)
        {
            mode = 2;
        } 
        break;
    }
    case 1://picture
    {

        

        if(slide_dir == LEFT){
            show = show->prev;
            slide_dir = -1;
        }
        else if(slide_dir == RIGHT){
            show = show->next;
            slide_dir = -1;
        }

        if(pause_album)//自动播放电子相册 1- 放 0- 暂停  初始为0
        {
            show = show->next;    
        }
        
        lcd_display_bmp(show->data, 0, 0);
        printf("%s\n",show->data);
        if(x > 600){
            mode = 0;
            printf("-->0");
        }              
        //sleep(1);
        
    }
        break;
    case 2://monitor
    {

                   
        get_gy39_data(COM2); //监测数据
        lcd_display_bmp("/root/hcc/motion.bmp",0,0);
        for(int i=0;i < 3;i ++)
        {
        lcd_display_word(250, 100+i*100, 56, 64, title[i*2], 0xffffff);
        lcd_display_word(250+56, 100+i*100, 56, 64, title[i*2+1], 0xffffff);
        lcd_display_word(250+56+56, 100+i*100, 56, 64, title[6], 0xffffff);

        lcd_display_number(250+56+56+56, 100+i*100, 40, 64,gy39_data[i], 0xffffff);
        }

        if(x > 600){
            mode = 0;
            
        }  
        
    }
    break;
    default:
        break;
    }
}